// The first integer is the distance from the town to the stop;.
// 尽信书不如无书.
#include <iostream>
#include <queue>
#include <algorithm>
using namespace std;
struct st {
  int a;
  int b;
  bool operator< (const st& st2) const {
    return this->a < st2.a;
  }
};
int N, L, P;
const int maxn = 1e4+7;
st stop[maxn+1];

void solve() {
  stop[N].a=L;stop[N].b=0;
  N++;
  priority_queue<int> pq;
  int pos=0, ans=0, tank=P;
  for(int i=0; i<N; ++i) {
    int d = stop[i].a - pos;
    while(tank<d) {
      if(pq.empty()) {
        cout<<"-1\n";
        return;
      }
      tank += pq.top();pq.pop();
      ans++;
    }
    tank -= d;
    pq.push(stop[i].b);
    pos = stop[i].a;
  }
  cout<<ans<<'\n';
  return;
}
int main() {
  cin>>N;
  for(int i=0; i<N; ++i) {
    cin>>stop[i].a>>stop[i].b;
  }
  cin>>L>>P;
  for(int i=0; i<N; ++i) {
    stop[i].a = L - stop[i].a;
  }
  sort(stop, stop+N);
  solve();
  return 0;
}
